<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />






<meta name="description" content="坐标轴–折线图演示：  代码：">
<meta property="og:type" content="article">
<meta property="og:title" content="canvas案例">
<meta property="og:url" content="http://yoursite.com/2017/08/31/canvas案例/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="坐标轴–折线图演示：  代码：">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://yoursite.com/img/zxt.png">
<meta property="og:image" content="http://yoursite.com/img/bzt.png">
<meta property="og:image" content="http://yoursite.com/img/guaishou.gif">
<meta property="og:updated_time" content="2017-09-20T07:27:29.050Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="canvas案例">
<meta name="twitter:description" content="坐标轴–折线图演示：  代码：">
<meta name="twitter:image" content="http://yoursite.com/img/zxt.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.2',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/08/31/canvas案例/"/>





  <title>canvas案例 | Hexo</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Hexo</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/08/31/canvas案例/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="shine-wl">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="http://dynamic-image.yesky.com/300x-/uploadImages/upload/20140912/upload/201409/wylnwjynkxijpg.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Hexo">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">canvas案例</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-08-31T21:26:15+08:00">
                2017-08-31
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="坐标轴–折线图"><a href="#坐标轴–折线图" class="headerlink" title="坐标轴–折线图"></a>坐标轴–折线图</h2><p>演示：</p>
<p><img src="/img/zxt.png" alt="image"></p>
<p>代码：</p>
<a id="more"></a>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div></pre></td><td class="code"><pre><div class="line">&lt;!DOCTYPE html&gt;</div><div class="line">&lt;html lang=<span class="string">"en"</span>&gt;</div><div class="line"></div><div class="line">&lt;head&gt;</div><div class="line">    &lt;meta charset=<span class="string">"UTF-8"</span>&gt;</div><div class="line">    &lt;meta name=<span class="string">"viewport"</span> content=<span class="string">"width=device-width, initial-scale=1.0"</span>&gt;</div><div class="line">    &lt;meta http-equiv=<span class="string">"X-UA-Compatible"</span> content=<span class="string">"ie=edge"</span>&gt;</div><div class="line">    &lt;title&gt;Document&lt;<span class="regexp">/title&gt;</span></div><div class="line"><span class="regexp">    &lt;style&gt;</span></div><div class="line"><span class="regexp">        canvas &#123;</span></div><div class="line"><span class="regexp">            border: 1px solid #cccccc;</span></div><div class="line"><span class="regexp">            display: block;</span></div><div class="line"><span class="regexp">            margin: 0 auto;</span></div><div class="line"><span class="regexp">        &#125;</span></div><div class="line"><span class="regexp">    &lt;/</span>style&gt;</div><div class="line">&lt;<span class="regexp">/head&gt;</span></div><div class="line"><span class="regexp"></span></div><div class="line"><span class="regexp">&lt;body&gt;</span></div><div class="line"><span class="regexp">    &lt;canvas width='600' height='400'&gt;&lt;/</span>canvas&gt;</div><div class="line">    &lt;script&gt;</div><div class="line">        <span class="keyword">var</span> data = [&#123;</div><div class="line">            x: <span class="number">100</span>,</div><div class="line">            y: <span class="number">80</span></div><div class="line">        &#125;, &#123;</div><div class="line">            x: <span class="number">200</span>,</div><div class="line">            y: <span class="number">120</span></div><div class="line">        &#125;, &#123;</div><div class="line">            x: <span class="number">300</span>,</div><div class="line">            y: <span class="number">250</span></div><div class="line">        &#125;, &#123;</div><div class="line">            x: <span class="number">400</span>,</div><div class="line">            y: <span class="number">340</span></div><div class="line">        &#125;, &#123;</div><div class="line">            x: <span class="number">500</span>,</div><div class="line">            y: <span class="number">230</span></div><div class="line">        &#125;];</div><div class="line"></div><div class="line">        <span class="function"><span class="keyword">function</span> <span class="title">LineChart</span>(<span class="params">data</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> canvas = <span class="built_in">document</span>.querySelector(<span class="string">'canvas'</span>)</div><div class="line">            <span class="keyword">this</span>.ctx = canvas.getContext(<span class="string">'2d'</span>)</div><div class="line">            <span class="keyword">this</span>.space = <span class="number">20</span></div><div class="line">            <span class="keyword">this</span>.page = <span class="number">10</span></div><div class="line">            <span class="keyword">this</span>.width = <span class="keyword">this</span>.ctx.canvas.width</div><div class="line">            <span class="keyword">this</span>.height = <span class="keyword">this</span>.ctx.canvas.height</div><div class="line">            <span class="keyword">this</span>.x0 = <span class="keyword">this</span>.space</div><div class="line">            <span class="keyword">this</span>.y0 = <span class="keyword">this</span>.height - <span class="keyword">this</span>.space</div><div class="line">            <span class="keyword">this</span>.data = data</div><div class="line">            <span class="keyword">this</span>.init()</div><div class="line">        &#125;</div><div class="line">        LineChart.prototype.init = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="keyword">this</span>.Dot()</div><div class="line">            <span class="keyword">this</span>.Axis()</div><div class="line">        &#125;</div><div class="line">        LineChart.prototype.formatDot = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> that = <span class="keyword">this</span></div><div class="line">            <span class="keyword">var</span> newData = []</div><div class="line">            that.data.forEach(<span class="function"><span class="keyword">function</span>(<span class="params">item, i</span>) </span>&#123;</div><div class="line">                <span class="keyword">var</span> x = item.x - that.x0</div><div class="line">                <span class="keyword">var</span> y = that.y0 - item.y</div><div class="line">                newData.push(&#123;</div><div class="line">                    x: x,</div><div class="line">                    y: y</div><div class="line">                &#125;)</div><div class="line">            &#125;)</div><div class="line">            <span class="keyword">return</span> newData</div><div class="line">        &#125;</div><div class="line">        LineChart.prototype.Dot = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> data = <span class="keyword">this</span>.formatDot()</div><div class="line">            <span class="keyword">var</span> that = <span class="keyword">this</span></div><div class="line">            data.forEach(<span class="function"><span class="keyword">function</span>(<span class="params">item, i</span>) </span>&#123;</div><div class="line">                that.ctx.beginPath()</div><div class="line">                that.ctx.moveTo(item.x + that.page / <span class="number">2</span>, item.y - that.page / <span class="number">2</span>)</div><div class="line">                that.ctx.lineTo(item.x - that.page / <span class="number">2</span>, item.y - that.page / <span class="number">2</span>)</div><div class="line">                that.ctx.lineTo(item.x - that.page / <span class="number">2</span>, item.y + that.page / <span class="number">2</span>)</div><div class="line">                that.ctx.lineTo(item.x + that.page / <span class="number">2</span>, item.y + that.page / <span class="number">2</span>)</div><div class="line">                that.ctx.closePath()</div><div class="line">                that.ctx.stroke()</div><div class="line">                that.ctx.fill()</div><div class="line">                that.ctx.beginPath()</div><div class="line">                <span class="keyword">if</span> (i == <span class="number">0</span>) &#123;</div><div class="line">                    that.ctx.moveTo(that.x0, that.y0)</div><div class="line">                    that.ctx.lineTo(item.x, item.y)</div><div class="line">                    that.ctx.stroke()</div><div class="line">                &#125; <span class="keyword">else</span> &#123;</div><div class="line">                    that.ctx.moveTo(data[i - <span class="number">1</span>].x, data[i - <span class="number">1</span>].y)</div><div class="line">                    that.ctx.lineTo(item.x, item.y)</div><div class="line">                    that.ctx.stroke()</div><div class="line">                &#125;</div><div class="line">            &#125;)</div><div class="line"></div><div class="line">        &#125;</div><div class="line">        LineChart.prototype.Axis = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="comment">// x轴</span></div><div class="line">            <span class="keyword">this</span>.ctx.moveTo(<span class="keyword">this</span>.x0, <span class="keyword">this</span>.y0)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.width - <span class="keyword">this</span>.x0, <span class="keyword">this</span>.y0)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.width - <span class="keyword">this</span>.space - <span class="keyword">this</span>.page, <span class="keyword">this</span>.y0 - <span class="keyword">this</span>.page / <span class="number">2</span>)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.width - <span class="keyword">this</span>.space - <span class="keyword">this</span>.page, <span class="keyword">this</span>.y0 + <span class="keyword">this</span>.page / <span class="number">2</span>)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.width - <span class="keyword">this</span>.space, <span class="keyword">this</span>.y0)</div><div class="line">            <span class="keyword">this</span>.ctx.fill()</div><div class="line">            <span class="keyword">this</span>.ctx.stroke()</div><div class="line"></div><div class="line">            <span class="comment">//y轴</span></div><div class="line">            <span class="keyword">this</span>.ctx.beginPath()</div><div class="line">            <span class="keyword">this</span>.ctx.moveTo(<span class="keyword">this</span>.x0, <span class="keyword">this</span>.y0)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.space, <span class="keyword">this</span>.space)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.space - <span class="keyword">this</span>.page / <span class="number">2</span>, <span class="keyword">this</span>.space + <span class="keyword">this</span>.page)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.space + <span class="keyword">this</span>.page / <span class="number">2</span>, <span class="keyword">this</span>.space + <span class="keyword">this</span>.page)</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.space, <span class="keyword">this</span>.space)</div><div class="line">            <span class="keyword">this</span>.ctx.fill()</div><div class="line">            <span class="keyword">this</span>.ctx.stroke()</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">new</span> LineChart(data)</div><div class="line">    &lt;<span class="regexp">/script&gt;</span></div><div class="line"><span class="regexp"></span></div><div class="line"><span class="regexp">&lt;/</span>body&gt;</div><div class="line"></div><div class="line">&lt;<span class="regexp">/html&gt;</span></div></pre></td></tr></table></figure>
<h2 id="饼状图"><a href="#饼状图" class="headerlink" title="饼状图"></a>饼状图</h2><p>演示：</p>
<p><img src="/img/bzt.png" alt="image"></p>
<p>代码：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div></pre></td><td class="code"><pre><div class="line">&lt;!DOCTYPE html&gt;</div><div class="line">&lt;html lang=<span class="string">"en"</span>&gt;</div><div class="line"></div><div class="line">&lt;head&gt;</div><div class="line">    &lt;meta charset=<span class="string">"UTF-8"</span>&gt;</div><div class="line">    &lt;meta name=<span class="string">"viewport"</span> content=<span class="string">"width=device-width, initial-scale=1.0"</span>&gt;</div><div class="line">    &lt;meta http-equiv=<span class="string">"X-UA-Compatible"</span> content=<span class="string">"ie=edge"</span>&gt;</div><div class="line">    &lt;title&gt;Document&lt;<span class="regexp">/title&gt;</span></div><div class="line"><span class="regexp">    &lt;style&gt;</span></div><div class="line"><span class="regexp">        canvas &#123;</span></div><div class="line"><span class="regexp">            border: 1px solid #ccc;</span></div><div class="line"><span class="regexp">            display: block;</span></div><div class="line"><span class="regexp">            margin: 0 auto;</span></div><div class="line"><span class="regexp">        &#125;</span></div><div class="line"><span class="regexp">    &lt;/</span>style&gt;</div><div class="line">&lt;<span class="regexp">/head&gt;</span></div><div class="line"><span class="regexp"></span></div><div class="line"><span class="regexp">&lt;body&gt;</span></div><div class="line"><span class="regexp">    &lt;canvas width='600' height='400'&gt;&lt;/</span>canvas&gt;</div><div class="line">    &lt;script&gt;</div><div class="line">        <span class="keyword">var</span> data = [&#123;</div><div class="line">            title: <span class="string">'15-20岁'</span>,</div><div class="line">            num: <span class="number">13</span>,</div><div class="line">        &#125;, &#123;</div><div class="line">            title: <span class="string">'20-25岁'</span>,</div><div class="line">            num: <span class="number">28</span>,</div><div class="line">        &#125;, &#123;</div><div class="line">            title: <span class="string">'25-30岁'</span>,</div><div class="line">            num: <span class="number">9</span>,</div><div class="line">        &#125;, &#123;</div><div class="line">            title: <span class="string">'30-35岁'</span>,</div><div class="line">            num: <span class="number">6</span>,</div><div class="line">        &#125;, &#123;</div><div class="line">            title: <span class="string">'35-40岁'</span>,</div><div class="line">            num: <span class="number">15</span>,</div><div class="line">        &#125;]</div><div class="line"></div><div class="line">        <span class="function"><span class="keyword">function</span> <span class="title">PieChart</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="keyword">this</span>.ctx = <span class="built_in">document</span>.querySelector(<span class="string">'canvas'</span>).getContext(<span class="string">'2d'</span>);</div><div class="line">            <span class="keyword">this</span>.width = <span class="keyword">this</span>.ctx.canvas.width;</div><div class="line">            <span class="keyword">this</span>.height = <span class="keyword">this</span>.ctx.canvas.height;</div><div class="line">            <span class="keyword">this</span>.radius = <span class="number">150</span>;</div><div class="line">            <span class="keyword">this</span>.x0 = <span class="keyword">this</span>.width / <span class="number">2</span> + <span class="number">50</span>;</div><div class="line">            <span class="keyword">this</span>.y0 = <span class="keyword">this</span>.height / <span class="number">2</span>;</div><div class="line">            <span class="keyword">this</span>.lineOut = <span class="number">20</span>;</div><div class="line">            <span class="keyword">this</span>.space = <span class="number">10</span>;</div><div class="line">        &#125;</div><div class="line">        PieChart.prototype.init = <span class="function"><span class="keyword">function</span>(<span class="params">data</span>) </span>&#123;</div><div class="line">            <span class="keyword">this</span>.drawPie(data);</div><div class="line">        &#125;</div><div class="line">        PieChart.prototype.transform = <span class="function"><span class="keyword">function</span>(<span class="params">data</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> sum = <span class="number">0</span>;</div><div class="line">            <span class="keyword">var</span> canvasData = [];</div><div class="line">            data.forEach(<span class="function"><span class="keyword">function</span>(<span class="params">item</span>) </span>&#123;</div><div class="line">                sum += item.num;</div><div class="line">            &#125;)</div><div class="line">            data.forEach(<span class="function"><span class="keyword">function</span>(<span class="params">item</span>) </span>&#123;</div><div class="line">                <span class="keyword">var</span> angle = item.num / sum * <span class="number">2</span> * <span class="built_in">Math</span>.PI;</div><div class="line">                <span class="keyword">var</span> s = item.num / sum;</div><div class="line">                canvasData.push(&#123;</div><div class="line">                    title: item.title,</div><div class="line">                    num: item.num,</div><div class="line">                    angle: angle,</div><div class="line">                    s: s + <span class="string">'%'</span></div><div class="line">                &#125;)</div><div class="line">            &#125;)</div><div class="line">            <span class="keyword">return</span> canvasData;</div><div class="line">        &#125;</div><div class="line">        PieChart.prototype.getColor = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> r = <span class="built_in">Math</span>.floor(<span class="built_in">Math</span>.random() * <span class="number">256</span>);</div><div class="line">            <span class="keyword">var</span> g = <span class="built_in">Math</span>.floor(<span class="built_in">Math</span>.random() * <span class="number">256</span>);</div><div class="line">            <span class="keyword">var</span> b = <span class="built_in">Math</span>.floor(<span class="built_in">Math</span>.random() * <span class="number">256</span>);</div><div class="line">            <span class="keyword">return</span> <span class="string">'rgb('</span> + r + <span class="string">','</span> + g + <span class="string">','</span> + b + <span class="string">')'</span>;</div><div class="line">        &#125;</div><div class="line">        PieChart.prototype.drawPie = <span class="function"><span class="keyword">function</span>(<span class="params">data</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> that = <span class="keyword">this</span>;</div><div class="line">            <span class="keyword">var</span> data = <span class="keyword">this</span>.transform(data);</div><div class="line">            <span class="keyword">var</span> startAngle = <span class="number">0</span>;</div><div class="line">            data.forEach(<span class="function"><span class="keyword">function</span>(<span class="params">item, i</span>) </span>&#123;</div><div class="line">                that.ctx.beginPath();</div><div class="line">                that.ctx.moveTo(that.x0, that.y0);</div><div class="line">                that.ctx.arc(that.x0, that.y0, that.radius, startAngle, startAngle + item.angle, <span class="literal">false</span>);</div><div class="line">                that.ctx.fillStyle = that.getColor();</div><div class="line">                that.ctx.fill();</div><div class="line">                <span class="keyword">var</span> color = that.ctx.fillStyle;</div><div class="line">                that.drawTitle(startAngle, item.angle, color, item.title)</div><div class="line">                that.drawDesc(item.title, i);</div><div class="line">                startAngle = startAngle + item.angle;</div><div class="line">            &#125;)</div><div class="line">        &#125;</div><div class="line">        PieChart.prototype.drawTitle = <span class="function"><span class="keyword">function</span>(<span class="params">startAngle, angle, color, title</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> edge = <span class="keyword">this</span>.radius + <span class="keyword">this</span>.lineOut</div><div class="line">            <span class="keyword">var</span> xEdge = <span class="built_in">Math</span>.cos(startAngle + angle / <span class="number">2</span>) * edge;</div><div class="line">            <span class="keyword">var</span> yEdge = <span class="built_in">Math</span>.sin(startAngle + angle / <span class="number">2</span>) * edge;</div><div class="line">            <span class="keyword">var</span> textWidth = <span class="keyword">this</span>.ctx.measureText(title).width;</div><div class="line">            <span class="keyword">this</span>.ctx.beginPath();</div><div class="line">            <span class="keyword">this</span>.ctx.moveTo(<span class="keyword">this</span>.x0, <span class="keyword">this</span>.y0);</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.x0 + xEdge, <span class="keyword">this</span>.y0 + yEdge);</div><div class="line">            <span class="keyword">if</span> (xEdge &gt; <span class="number">0</span>) &#123;</div><div class="line">                <span class="keyword">this</span>.ctx.textAlign = <span class="string">'left'</span>;</div><div class="line">                <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.x0 + xEdge + textWidth, <span class="keyword">this</span>.y0 + yEdge);</div><div class="line">            &#125; <span class="keyword">else</span> &#123;</div><div class="line">                <span class="keyword">this</span>.ctx.textAlign = <span class="string">'right'</span>;</div><div class="line">                <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.x0 + xEdge - textWidth, <span class="keyword">this</span>.y0 + yEdge);</div><div class="line">            &#125;</div><div class="line">            <span class="keyword">this</span>.ctx.textBaseline = <span class="string">'bottom'</span>;</div><div class="line">            <span class="keyword">this</span>.ctx.strokeStyle = color;</div><div class="line">            <span class="keyword">this</span>.ctx.fillText(title, <span class="keyword">this</span>.x0 + xEdge, <span class="keyword">this</span>.y0 + yEdge)</div><div class="line">            <span class="keyword">this</span>.ctx.stroke();</div><div class="line">        &#125;</div><div class="line">        PieChart.prototype.drawDesc = <span class="function"><span class="keyword">function</span>(<span class="params">title, i</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> x = <span class="number">20</span>,</div><div class="line">                y = <span class="number">20</span>;</div><div class="line">            <span class="keyword">this</span>.ctx.beginPath();</div><div class="line">            <span class="keyword">this</span>.ctx.fillRect(x, y + i * (<span class="number">16</span> + <span class="keyword">this</span>.space), <span class="number">30</span>, <span class="number">16</span>)</div><div class="line">            <span class="keyword">this</span>.ctx.textAlign = <span class="string">'left'</span>;</div><div class="line">            <span class="keyword">this</span>.ctx.fillText(title, x + <span class="number">30</span> + <span class="keyword">this</span>.space, y + i * (<span class="number">15</span> + <span class="keyword">this</span>.space) + <span class="number">16</span>)</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">new</span> PieChart().init(data);</div><div class="line">    &lt;<span class="regexp">/script&gt;</span></div><div class="line"><span class="regexp">&lt;/</span>body&gt;</div><div class="line"></div><div class="line">&lt;<span class="regexp">/html&gt;</span></div></pre></td></tr></table></figure>
<h2 id="怪兽刮奖"><a href="#怪兽刮奖" class="headerlink" title="怪兽刮奖"></a>怪兽刮奖</h2><p><img src="/img/guaishou.gif" alt="image"></p>
<p>代码：<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div></pre></td><td class="code"><pre><div class="line">&lt;!DOCTYPE html&gt;</div><div class="line">&lt;html lang=<span class="string">"en"</span>&gt;</div><div class="line"></div><div class="line">&lt;head&gt;</div><div class="line">    &lt;meta charset=<span class="string">"UTF-8"</span>&gt;</div><div class="line">    &lt;meta name=<span class="string">"viewport"</span> content=<span class="string">"width=device-width, initial-scale=1.0"</span>&gt;</div><div class="line">    &lt;meta http-equiv=<span class="string">"X-UA-Compatible"</span> content=<span class="string">"ie=edge"</span>&gt;</div><div class="line">    &lt;title&gt;Document&lt;<span class="regexp">/title&gt;</span></div><div class="line"><span class="regexp">    &lt;style&gt;</span></div><div class="line"><span class="regexp">        canvas &#123;</span></div><div class="line"><span class="regexp">            display: block;</span></div><div class="line"><span class="regexp">            border: 1px solid #ccc;</span></div><div class="line"><span class="regexp">            margin: 0 auto;</span></div><div class="line"><span class="regexp">        &#125;</span></div><div class="line"><span class="regexp">    &lt;/</span>style&gt;</div><div class="line">&lt;<span class="regexp">/head&gt;</span></div><div class="line"><span class="regexp"></span></div><div class="line"><span class="regexp">&lt;body&gt;</span></div><div class="line"><span class="regexp">    &lt;canvas width='600' height='400'&gt;&lt;/</span>canvas&gt;</div><div class="line">    &lt;script&gt;</div><div class="line">        <span class="comment">// 初始化  画布数据</span></div><div class="line">        <span class="function"><span class="keyword">function</span> <span class="title">Per</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="keyword">this</span>.ctx = <span class="built_in">document</span>.querySelector(<span class="string">'canvas'</span>).getContext(<span class="string">'2d'</span>);</div><div class="line">            <span class="keyword">this</span>.width = <span class="keyword">this</span>.ctx.canvas.width;</div><div class="line">            <span class="keyword">this</span>.height = <span class="keyword">this</span>.ctx.canvas.height;</div><div class="line">            <span class="keyword">this</span>.index = <span class="number">0</span>;</div><div class="line">            <span class="keyword">this</span>.step = <span class="number">5</span>;</div><div class="line">        &#125;</div><div class="line">        Per.prototype.init = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> that = <span class="keyword">this</span>;</div><div class="line">            <span class="comment">//调用执行 传递一个回调函数</span></div><div class="line">            <span class="keyword">this</span>.loadImg(<span class="function"><span class="keyword">function</span>(<span class="params">img</span>) </span>&#123;</div><div class="line">                <span class="comment">//接收来自callback的参数 并执行</span></div><div class="line">                that.perWidth = img.width / <span class="number">4</span>;</div><div class="line">                that.perHeight = img.height / <span class="number">4</span>;</div><div class="line">                that.startX = that.width / <span class="number">2</span> - that.perWidth / <span class="number">2</span>;</div><div class="line">                that.startY = that.height / <span class="number">2</span> - that.perHeight / <span class="number">2</span>;</div><div class="line">                <span class="comment">// 怪兽移动</span></div><div class="line">                that.move(img, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>);</div><div class="line">                <span class="comment">// 怪兽方向控制</span></div><div class="line">                that.position(img);</div><div class="line">            &#125;)</div><div class="line">            <span class="keyword">this</span>.line();</div><div class="line">        &#125;</div><div class="line"></div><div class="line">        <span class="comment">// 怪兽绘制</span></div><div class="line">        Per.prototype.loadImg = <span class="function"><span class="keyword">function</span>(<span class="params">callback</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> img = <span class="keyword">new</span> Image();</div><div class="line">            img.onload = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">                <span class="comment">//判断是否有回调函数，有就执行，并传递一个参数img</span></div><div class="line">                callback &amp;&amp; callback(img);</div><div class="line">            &#125;</div><div class="line">            img.src = <span class="string">'image/04.png'</span>;</div><div class="line">        &#125;</div><div class="line"></div><div class="line">        <span class="comment">//设置刮刮乐背景图片填充</span></div><div class="line">        Per.prototype.line = <span class="function"><span class="keyword">function</span>(<span class="params">callback</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> that = <span class="keyword">this</span>;</div><div class="line">            <span class="keyword">var</span> img1 = <span class="keyword">new</span> Image();</div><div class="line">            <span class="comment">// 判断图片是否加载完成</span></div><div class="line">            img1.onload = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">                that.ctx.moveTo(that.startX + <span class="number">40</span>, that.startY + <span class="number">50</span>);</div><div class="line">                that.ctx.lineCap = <span class="string">'round'</span>;</div><div class="line">                that.ctx.lineJoin = <span class="string">'round'</span>;</div><div class="line">                that.ctx.strokeStyle = that.ctx.createPattern(img1, <span class="string">'no-repeat'</span>);</div><div class="line">                that.ctx.lineWidth = <span class="number">80</span>;</div><div class="line">            &#125;</div><div class="line">            img1.src = <span class="string">'image/05.jpg'</span>;</div><div class="line">        &#125;</div><div class="line"></div><div class="line">        <span class="comment">// 方向控制</span></div><div class="line">        Per.prototype.position = <span class="function"><span class="keyword">function</span>(<span class="params">img</span>) </span>&#123;</div><div class="line">            <span class="keyword">var</span> that = <span class="keyword">this</span>;</div><div class="line">            <span class="keyword">var</span> direction = <span class="number">0</span>;</div><div class="line">            <span class="keyword">var</span> stepX = <span class="number">0</span>;</div><div class="line">            <span class="keyword">var</span> stepY = <span class="number">0</span>;</div><div class="line">            <span class="built_in">document</span>.addEventListener(<span class="string">'keydown'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">e</span>) </span>&#123;</div><div class="line">                that.isDown = <span class="literal">true</span>;</div><div class="line">                <span class="keyword">switch</span> (e.keyCode) &#123;</div><div class="line">                    <span class="keyword">case</span> <span class="number">37</span>:</div><div class="line">                        stepX--;</div><div class="line">                        direction = <span class="number">1</span>;</div><div class="line">                        <span class="keyword">break</span>;</div><div class="line">                    <span class="keyword">case</span> <span class="number">38</span>:</div><div class="line">                        stepY--;</div><div class="line">                        direction = <span class="number">3</span>;</div><div class="line">                        <span class="keyword">break</span>;</div><div class="line">                    <span class="keyword">case</span> <span class="number">39</span>:</div><div class="line">                        stepX++;</div><div class="line">                        direction = <span class="number">2</span>;</div><div class="line">                        <span class="keyword">break</span>;</div><div class="line">                    <span class="keyword">case</span> <span class="number">40</span>:</div><div class="line">                        stepY++;</div><div class="line">                        direction = <span class="number">0</span>;</div><div class="line">                        <span class="keyword">break</span>;</div><div class="line">                &#125;</div><div class="line">                that.move(img, stepX, stepY, direction)</div><div class="line">                that.smove(stepX, stepY)</div><div class="line">            &#125;)</div><div class="line"></div><div class="line">        &#125;</div><div class="line"></div><div class="line">        <span class="comment">// 刮刮乐 移动描边</span></div><div class="line">        Per.prototype.smove = <span class="function"><span class="keyword">function</span>(<span class="params">stepX, stepY</span>) </span>&#123;</div><div class="line">            <span class="keyword">this</span>.ctx.lineTo(<span class="keyword">this</span>.startX + (stepX * <span class="keyword">this</span>.step) + <span class="number">40</span>, <span class="keyword">this</span>.startY + (stepY * <span class="keyword">this</span>.step) + <span class="number">50</span>);</div><div class="line">            <span class="keyword">this</span>.ctx.stroke();</div><div class="line">        &#125;;</div><div class="line">        <span class="comment">// 怪兽移动</span></div><div class="line">        Per.prototype.move = <span class="function"><span class="keyword">function</span>(<span class="params">img, stepX, stepY, direction</span>) </span>&#123;</div><div class="line">            <span class="keyword">this</span>.ctx.clearRect(<span class="number">0</span>, <span class="number">0</span>, <span class="keyword">this</span>.width, <span class="keyword">this</span>.height)</div><div class="line">            <span class="keyword">this</span>.index++;</div><div class="line">            <span class="keyword">if</span> (<span class="keyword">this</span>.index &gt; <span class="number">3</span>) &#123;</div><div class="line">                <span class="keyword">this</span>.index = <span class="number">0</span>;</div><div class="line">            &#125;</div><div class="line">            <span class="comment">// 设置层级永远显示在最上面</span></div><div class="line">            <span class="keyword">this</span>.ctx.globalCompositeOperation = <span class="string">'destination-over'</span>;</div><div class="line">            <span class="keyword">this</span>.ctx.drawImage(img, <span class="keyword">this</span>.index * <span class="keyword">this</span>.perWidth, direction * <span class="keyword">this</span>.perHeight, <span class="keyword">this</span>.perWidth, <span class="keyword">this</span>.perHeight, <span class="keyword">this</span>.startX + (stepX * <span class="keyword">this</span>.step), <span class="keyword">this</span>.startY + (stepY * <span class="keyword">this</span>.step), <span class="keyword">this</span>.perWidth, <span class="keyword">this</span>.perHeight)</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">new</span> Per().init();</div><div class="line">    &lt;<span class="regexp">/script&gt;</span></div><div class="line"><span class="regexp">&lt;/</span>body&gt;</div><div class="line"></div><div class="line">&lt;<span class="regexp">/html&gt;</span></div></pre></td></tr></table></figure></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/08/30/yxl/" rel="next" title="原型链问题">
                <i class="fa fa-chevron-left"></i> 原型链问题
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/02/闭包/" rel="prev" title="闭包">
                闭包 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="http://dynamic-image.yesky.com/300x-/uploadImages/upload/20140912/upload/201409/wylnwjynkxijpg.jpg"
               alt="shine-wl" />
          <p class="site-author-name" itemprop="name">shine-wl</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
            
              <a href="/archives/">
            
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">标签</span>
              
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#坐标轴–折线图"><span class="nav-number">1.</span> <span class="nav-text">坐标轴–折线图</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#饼状图"><span class="nav-number">2.</span> <span class="nav-text">饼状图</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#怪兽刮奖"><span class="nav-number">3.</span> <span class="nav-text">怪兽刮奖</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">shine-wl</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动</div>

  <span class="post-meta-divider">|</span>

  <div class="theme-info">主题 &mdash; <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.2</div>


        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  








  





  

  

  

  

  

  

</body>
</html>
